﻿using System;
using System.Collections.Generic;
using System.Linq;
using TuxedoLib;

namespace SpaceSquirrel.SpriteRenderers
{
	class PoofRenderer : SpriteRenderer
	{
		public override void Render(Sprite sprite, PlayScene scene, Image screen, int offsetX, int offsetY, int renderCounter)
		{
			Automation.PoofAutomation pa = sprite.automation as Automation.PoofAutomation;
			bool isBig = pa.isBig;
			int left = sprite.x + offsetX - 8;
			int top = sprite.y + offsetY - 8;
			int c = pa.counter;
			string num;
			if (c <= 3) num = "1";
			else if (c <= 6) num = "2";
			else if (c < 9) num = "3";
			else return;

			Image img;
			if (isBig)
			{
				top -= 16;
				img = ImageLibrary.GetImage("sprites/large_poof_" + num + ".png");
			}
			else
			{
				img = ImageLibrary.GetImage("sprites/small_poof_" + num + ".png");
			}
			screen.Blit(img, left, top);
		}
	}
}
